import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  strict: true,
  state: {
    count: 100,
    title: '养一只鸡'
  },
  mutations: {
    changeCount (state, newValue) {
      state.count = newValue
    },
    addCount (state, obj) {
      state.count += obj.n
      console.log(obj.msg)
    },
    subCount (state, newCount) {
      state.count -= newCount
    },
    changeTitle (state, newTitle) {
      state.title = newTitle
    }
  }
})

export default store
